package com.lagou.sqlSession;

import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.List;

/**
 * @author jsy
 * @description: TODO
 * @date 2021/8/28 20:03
 */
public interface SqlSession {

    /**
     * 查询所有   statementId 确定唯一标识找xml方法
     *
     * @param statementId
     * @param params
     * @param <T>
     * @return
     * @throws SQLException
     * @throws IllegalAccessException
     * @throws IntrospectionException
     * @throws InstantiationException
     * @throws NoSuchFieldException
     * @throws InvocationTargetException
     * @throws ClassNotFoundException
     */
    public <T> List<T> selectList(String statementId,Object... params) throws SQLException, IllegalAccessException, IntrospectionException, InstantiationException, NoSuchFieldException, InvocationTargetException, ClassNotFoundException;

    /**
     * 查询单个条件
     *
     * @param statementId
     * @param params
     * @param <T>
     * @return
     * @throws SQLException
     * @throws IllegalAccessException
     * @throws IntrospectionException
     * @throws InstantiationException
     * @throws ClassNotFoundException
     * @throws InvocationTargetException
     * @throws NoSuchFieldException
     */
    public <T> T selectOne(String statementId,Object... params) throws SQLException, IllegalAccessException, IntrospectionException, InstantiationException, ClassNotFoundException, InvocationTargetException, NoSuchFieldException;

    /**
     * 增加，删除，修改
     *
     * @param statementId
     * @param params
     * @return
     * @throws SQLException
     * @throws IllegalAccessException
     * @throws IntrospectionException
     * @throws InstantiationException
     * @throws ClassNotFoundException
     * @throws InvocationTargetException
     * @throws NoSuchFieldException
     */
    public int executeQuery(String statementId,Object... params) throws SQLException, IllegalAccessException, IntrospectionException, InstantiationException, ClassNotFoundException, InvocationTargetException, NoSuchFieldException;

    /**
     * 为Dao接口生成代理实现类
     *
     * @param mapperClass
     * @param <T>
     * @return
     */
    public <T> T getMapper(Class<?> mapperClass);
}
